package com.road.yishi.execaction;

import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Description :
 * @FileName: CustomRejectedExecutionHandler.java
 * @Author :WeiHui.Zhang
 * @Data : 2016年2月1日 下午7:55:06
 * @Version:V1.00
 */
public class CustomRejectedExecutionHandler implements RejectedExecutionHandler {

	private final static Logger LOG = LoggerFactory.getLogger(CustomRejectedExecutionHandler.class);

	@Override
	public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) {
		LOG.info("Current taskNum : " + executor.getTaskCount() + " , current activeCount : " + executor.getActiveCount());
		// new Thread(r).start();
		executor.execute(r);
	}
}
